import java.util.HashMap;
import java.util.*;

public class demo1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int num = in.nextInt();
            in.nextLine();
            int count = 0;
            HashMap<Integer, Integer> map = new HashMap<>();
            int[] hs = new int[num];
            for (int i = 0; i < num; i++) {
                String[] s = in.nextLine().split(" ");
                int w = Integer.parseInt(s[1]);
                int h = Integer.parseInt(s[2]);
                map.put(h, w);
                hs[i] = h;
            }
            Arrays.sort(hs);
            for (int i = num - 1; i >= 0; i--) {
                int temp = 1;
                for (int j = i ; j > 0; j--) {
                    int w1 = map.get(hs[j]);
                    int ws = map.get(hs[j-1]);
                    if (ws > w1) {
                        continue;
                    }else{
                        temp += 1;
                    }

                }
                count = Math.max(temp,count);
            }
            System.out.println(count);
        }
    }
}
